import request from '@/utils/request';
import { stringify } from 'qs';
import { toFormData } from '@/utils/utils.jsx';

// 合格证列表
export async function getTableListOp(params) {
  return request(`/blade-goods/ecGoodsCofcTemplate/page?${stringify(params)}`);
}

// add
export async function addOp(params) {
  return request(`/blade-goods/ecGoodsCofcTemplate/save`, {
    method: 'POST',
    data: params,
  });
}

// delete
export async function deleteOp(params) {
  return request(`/blade-goods/ecGoodsCofcTemplate/remove`, {
    method: 'POST',
    body: toFormData(params),
  });
}

// update
export async function updateOp(params) {
  return request(`/blade-goods/ecGoodsCofcTemplate/update`, {
    method: 'POST',
    data: params,
  });
}

// 在使用数
export async function getCountOp(params) {
  return request(
    `/blade-goods/ecGoodsCofcTemplate/use/count?${stringify(params)}`
  );
}

// detail
export async function getDetailOp(params) {
  return request(
    `/blade-goods/ecGoodsCofcTemplate/detail?${stringify(params)}`
  );
}

// 平台网店列表
export async function getShopListOp(params) {
  return request(`/blade-goods/ecstore/list/page?${stringify(params)}`);
}

// 获取分类属性:维护合格证/新增/批量设置分类属性的时候用
export async function getGoodsCategoryByUuid(params) {
  return request(
    `/blade-goods/goodscategory/getGoodsCategoryByUuid?${stringify(params)}`
  );
}

// 默认合格证禁用启用
export async function isEnableDisable(params) {
  return request(`/blade-goods/ecGoodsCofcTemplate/isEnableDisable`, {
    method: 'POST',
    //   data: params,
    body: toFormData(params),
  });
}

// 查询默认合格证
export async function queryDefaultTemplate(params) {
    return request(
      `/blade-goods/ecGoodsCofcTemplate/queryDefault?${stringify(params)}`
    );
  }
  